from re import S, T
from numpy import square
from manimlib import *
#75cfb8
#bbdfc8
#f0e5d8
#ffc478
class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        frame = self.camera.frame
        # self.play(frame.animate.set_width(32))
        sx=Square(6).set_fill('#75cfb8',1)
        sy=Square(2).set_fill(WHITE,1).shift(UR*2)
        l=Line(LEFT*3,RIGHT).shift(UP)
        self.add(sx,sy,l)
        #
        bx=Brace(sx,DOWN)
        by=Brace(sy,RIGHT)
        b1=Brace(l,UP).shift(UP*2)
        b2=Brace(Line(UP,DOWN*3).shift(LEFT*3),LEFT)
        tx=Tex('x').next_to(bx,DOWN)
        ty=Tex('y').next_to(by,RIGHT)
        t1=Tex('x-y').next_to(b1,UP)
        t2=Tex('x-y').next_to(b2,LEFT)
        self.add(bx,by,b1,tx,ty,t1,b2,t2)
        self.wait()
class p2(Scene):
    def construct(self):
        # self.add(NumberPlane())
        frame = self.camera.frame
        # self.play(frame.animate.set_width(32))
        sx=Square(6).set_fill('#75cfb8',1)
        sy=Square(2).set_fill(WHITE,1).shift(UR*2)
        l=Line(LEFT*3,RIGHT).shift(UP)
        self.add(sx,sy,l)
        #
        bx=Brace(Line([-3,-3,0],[5,-2,0]),DOWN)
        by=Brace(sy,RIGHT)
        b1=Brace(l,UP).shift(UP*2)
        b2=Brace(Line(UP,DOWN*3).shift(LEFT*3),LEFT)
        tx=Tex('x+y').next_to(bx,DOWN)
        ty=Tex('y').next_to(by,RIGHT)
        t1=Tex('x-y').next_to(b1,UP)
        t2=Tex('x-y').next_to(b2,LEFT)
        self.add(bx,by,b1,tx,ty,t1,b2,t2)
        s=Square().stretch(2,1)
        self.add(s.copy().move_to([4,-1,0]).set_fill('#75cfb8',1))
        self.add(s.copy().rotate(PI/2).shift(UP*2+LEFT).set_fill(WHITE,1))
        self.wait()